#pragma once

#include <QDialog>
#include "typedefs.h"
#include "ui_addWordDialog.h"

namespace Ui {
class addWordDialog;
}

class addWordDialog : public QDialog
{
	Q_OBJECT

public:
	explicit addWordDialog(QWidget *parent = 0);
	inline WordList *wordList(void) {
		WordList *list = new WordList();
		for(int i = 0; i < ui->tableWidget->rowCount(); i++)
			list->append(new WordItem(ui->tableWidget->item(i, 0)->text(), ui->tableWidget->item(i, 2)->text()
					  , !ui->tableWidget->item(i, 1) ? "" : ui->tableWidget->item(i, 1)->text()));
		return list;
	}
	~addWordDialog();
private slots:
	void on_addButton_clicked();
	void on_removeButton_clicked();
	void addingDone();
signals:
	void accepted(WordList *newWords);
private:
	Ui::addWordDialog *ui;
};
